Leaflet is a JavaScript library for creating dynamic maps that support panning and zooming along with various annotations.


https://rstudio.github.io/leaflet/

d3heatmap creates interactive D3 heatmaps including support for row/column highlighting and zooming.


https://github.com/rstudio/d3heatmap/

Dygraphs provides rich facilities for charting time-series data in R and includes support for many interactive features.


https://rstudio.github.io/dygraphs/

MetricsGraphics enables easy creation of D3 scatterplots, line charts, and histograms.


https://hrbrmstr.github.io/metricsgraphics/

Building metricsgraphics charts follows the “piping” idiom made popular through the magrittr, ggvis and dplyr packages. This makes it possible to avoid one giant function with a ton of parameters and facilitates breaking out the chart building into logical steps.

While MetricsGraphics.js charts may not have the flexibility of ggplot2, you can build functional, interactive [multi-]line, scatterplot, bar charts & histograms and + even link charts together.

---
title: "IRA Soil Carbon Monitoring"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    social: menu
    source: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
```

### Leaflet is a JavaScript library for creating dynamic maps that support panning and zooming along with various annotations.
```{r}
library(here)
library(tmap)
load(here('data/derived_data/IRA_sites.Rdata'))
tmap_mode("view")
  tm_shape(states) +
    tm_borders() +
    tm_lines(lwd = "strokelwd", legend.lwd.show = FALSE) +
    tm_shape(ceap) +
    tm_fill(col="#1B9E77", size=0.3) +
    tm_shape(ltar_site) +
    tm_dots(col="#D95F02", size=0.3) +
    tm_shape(pedon) +
    tm_dots(col="#7570B3", size=0.02) +
    tm_shape(raca_gen_loc) +
    tm_dots(col="#E7298A", size=0.02) +

    #tm_compass() + 
    #tm_scale_bar(position = c(0.06, 0.05)) +
    tm_add_legend('fill', 
	col = c( "#E7298A","#1B9E77", "#D95F02","#7570B3"),
	border.col = "grey40",
	size = 1,
	labels = c('RaCA','CEAP','LTAR','KSSL (>2010)'),
	title="Potential Sampling Areas") +
    tm_layout(main.title = "IRA Sampling", bg.color = "white", legend.outside = TRUE)  +
    tm_view(set.view = c(-99.22, 39.13,  5))
```

***

https://rstudio.github.io/leaflet/

- Interactive panning/zooming

- Compose maps using arbitrary combinations of map tiles, markers, polygons, lines, popups, and GeoJSON.

- Create maps right from the R console or RStudio

- Embed maps in knitr/R Markdown documents and Shiny apps

- Easily render Spatial objects from the sp package, or data frames with latitude/longitude columns

- Use map bounds and mouse events to drive Shiny logic


### d3heatmap creates interactive D3 heatmaps including support for row/column highlighting and zooming.

```{r}
library(d3heatmap)
d3heatmap(mtcars, scale="column", colors="Blues")
```

***

https://github.com/rstudio/d3heatmap/

- Highlight rows/columns by clicking axis labels

- Click and drag over colormap to zoom in (click on colormap to zoom out)

- Optional clustering and dendrograms, courtesy of base::heatmap


### Dygraphs provides rich facilities for charting time-series data in R and includes support for many interactive features.

```{r}
library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Diseases in the UK") %>%
  dySeries("mdeaths", label = "Male") %>%
  dySeries("fdeaths", label = "Female") %>%
  dyOptions(stackedGraph = TRUE) %>%
  dyRangeSelector(height = 20) %>% 
  dyRangeSelector()
```

***

https://rstudio.github.io/dygraphs/

- Automatically plots xts time series objects (or any object convertible to xts).

- Highly configurable axis and series display (including optional second Y-axis).

- Rich interactive features including zoom/pan and series/point highlighting.

- Display upper/lower bars (e.g. prediction intervals) around series.
- Various graph overlays including shaded regions, event lines, and point annotations.



### MetricsGraphics enables easy creation of D3 scatterplots, line charts, and histograms.

```{r}
library(metricsgraphics)
mjs_plot(mtcars, x=wt, y=mpg) %>%
  mjs_point(color_accessor=carb, size_accessor=carb) %>%
  mjs_labs(x="Weight of Car", y="Miles per Gallon")
```

***

https://hrbrmstr.github.io/metricsgraphics/

Building metricsgraphics charts follows the “piping” idiom made popular through the magrittr, ggvis and dplyr packages. This makes it possible to avoid one giant function with a ton of parameters and facilitates breaking out the chart building into logical steps. 

While MetricsGraphics.js charts may not have the flexibility of ggplot2, you can build functional, interactive [multi-]line, scatterplot, bar charts & histograms and + even link charts together.